package com.java46.carera.maintain.controller;

import com.java46.carera.base.entity.JsonResult;
import com.java46.carera.base.entity.Maintain;
import com.java46.carera.maintain.service.MaintainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName MaintainController
 * @Description 维修管理Controller
 * @Author c
 * @Date 2018/8/27 13:49
 * @Vcrsion 1.0
 **/
@Controller
@RequestMapping("/Maintain")
public class MaintainController {

    @Autowired
    private MaintainService maintainService;

    @RequestMapping("/add")
    @ResponseBody
    public JsonResult addMaintain(Maintain maintain){
        return maintainService.addMaintain(maintain);
    }

    @RequestMapping("/update")
    @ResponseBody
    public JsonResult updateMaintain(Maintain maintain){
        return maintainService.updateMaintain(maintain);
    }

    @RequestMapping("/delete")
    @ResponseBody
    public JsonResult deleteMaintain(Integer maiid){
        return maintainService.deleteMaintain(maiid);
    }

    @RequestMapping("/queryAll")
    @ResponseBody
    public JsonResult queryAll(String keyword, Integer pageNum){
        return maintainService.queryAll(keyword,pageNum);
    }

    @RequestMapping("/queryById")
    @ResponseBody
    public JsonResult selectByPrimaryKey(Integer maiid){
        return maintainService.selectByPrimaryKey(maiid);
    }
}
